\(\int \frac {\sin ^2(c+d x)}{a+b \sin ^2(c+d x)} \, dx\) [88]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F(-1)]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 23, antiderivative size = 46 \[ \int \frac {\sin ^2(c+d x)}{a+b \sin ^2(c+d x)} \, dx=\frac {x}{b}-\frac {\sqrt {a} \arctan \left (\frac {\sqrt {a+b} \tan (c+d x)}{\sqrt {a}}\right )}{b \sqrt {a+b} d} \]

[Out]

x/b-arctan((a+b)^(1/2)*tan(d*x+c)/a^(1/2))*a^(1/2)/b/d/(a+b)^(1/2)

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 46, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.130, Rules used = {3250, 3260, 211} \[ \int \frac {\sin ^2(c+d x)}{a+b \sin ^2(c+d x)} \, dx=\frac {x}{b}-\frac {\sqrt {a} \arctan \left (\frac {\sqrt {a+b} \tan (c+d x)}{\sqrt {a}}\right )}{b d \sqrt {a+b}} \]

[In]

Int[Sin[c + d*x]^2/(a + b*Sin[c + d*x]^2),x]

[Out]

x/b - (Sqrt[a]*ArcTan[(Sqrt[a + b]*Tan[c + d*x])/Sqrt[a]])/(b*Sqrt[a + b]*d)

Rule 211

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/Rt[a/b, 2]], x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 3250

Int[((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)]^2)/((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[B*(x
/b), x] + Dist[(A*b - a*B)/b, Int[1/(a + b*Sin[e + f*x]^2), x], x] /; FreeQ[{a, b, e, f, A, B}, x]

Rule 3260

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(-1), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Dist
[ff/f, Subst[Int[1/(a + (a + b)*ff^2*x^2), x], x, Tan[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f}, x]

Rubi steps \begin{align*} \text {integral}& = \frac {x}{b}-\frac {a \int \frac {1}{a+b \sin ^2(c+d x)} \, dx}{b} \\ & = \frac {x}{b}-\frac {a \text {Subst}\left (\int \frac {1}{a+(a+b) x^2} \, dx,x,\tan (c+d x)\right )}{b d} \\ & = \frac {x}{b}-\frac {\sqrt {a} \arctan \left (\frac {\sqrt {a+b} \tan (c+d x)}{\sqrt {a}}\right )}{b \sqrt {a+b} d} \\ \end{align*}

Mathematica [A] (verified)

Time = 1.41 (sec) , antiderivative size = 46, normalized size of antiderivative = 1.00 \[ \int \frac {\sin ^2(c+d x)}{a+b \sin ^2(c+d x)} \, dx=\frac {c+d x-\frac {\sqrt {a} \arctan \left (\frac {\sqrt {a+b} \tan (c+d x)}{\sqrt {a}}\right )}{\sqrt {a+b}}}{b d} \]

[In]

Integrate[Sin[c + d*x]^2/(a + b*Sin[c + d*x]^2),x]

[Out]

(c + d*x - (Sqrt[a]*ArcTan[(Sqrt[a + b]*Tan[c + d*x])/Sqrt[a]])/Sqrt[a + b])/(b*d)

Maple [A] (verified)

Time = 0.41 (sec) , antiderivative size = 48, normalized size of antiderivative = 1.04

method result size
derivativedivides \(\frac {\frac {\arctan \left (\tan \left (d x +c \right )\right )}{b}-\frac {a \arctan \left (\frac {\left (a +b \right ) \tan \left (d x +c \right )}{\sqrt {a \left (a +b \right )}}\right )}{b \sqrt {a \left (a +b \right )}}}{d}\) \(48\)
default \(\frac {\frac {\arctan \left (\tan \left (d x +c \right )\right )}{b}-\frac {a \arctan \left (\frac {\left (a +b \right ) \tan \left (d x +c \right )}{\sqrt {a \left (a +b \right )}}\right )}{b \sqrt {a \left (a +b \right )}}}{d}\) \(48\)
risch \(\frac {x}{b}-\frac {\sqrt {-a \left (a +b \right )}\, \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+\frac {2 i \sqrt {-a \left (a +b \right )}-2 a -b}{b}\right )}{2 \left (a +b \right ) d b}+\frac {\sqrt {-a \left (a +b \right )}\, \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {2 i \sqrt {-a \left (a +b \right )}+2 a +b}{b}\right )}{2 \left (a +b \right ) d b}\) \(114\)

[In]

int(sin(d*x+c)^2/(a+b*sin(d*x+c)^2),x,method=_RETURNVERBOSE)

[Out]

1/d*(1/b*arctan(tan(d*x+c))-1/b*a/(a*(a+b))^(1/2)*arctan((a+b)*tan(d*x+c)/(a*(a+b))^(1/2)))

Fricas [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 260, normalized size of antiderivative = 5.65 \[ \int \frac {\sin ^2(c+d x)}{a+b \sin ^2(c+d x)} \, dx=\left [\frac {4 \, d x + \sqrt {-\frac {a}{a + b}} \log \left (\frac {{\left (8 \, a^{2} + 8 \, a b + b^{2}\right )} \cos \left (d x + c\right )^{4} - 2 \, {\left (4 \, a^{2} + 5 \, a b + b^{2}\right )} \cos \left (d x + c\right )^{2} + 4 \, {\left ({\left (2 \, a^{2} + 3 \, a b + b^{2}\right )} \cos \left (d x + c\right )^{3} - {\left (a^{2} + 2 \, a b + b^{2}\right )} \cos \left (d x + c\right )\right )} \sqrt {-\frac {a}{a + b}} \sin \left (d x + c\right ) + a^{2} + 2 \, a b + b^{2}}{b^{2} \cos \left (d x + c\right )^{4} - 2 \, {\left (a b + b^{2}\right )} \cos \left (d x + c\right )^{2} + a^{2} + 2 \, a b + b^{2}}\right )}{4 \, b d}, \frac {2 \, d x + \sqrt {\frac {a}{a + b}} \arctan \left (\frac {{\left ({\left (2 \, a + b\right )} \cos \left (d x + c\right )^{2} - a - b\right )} \sqrt {\frac {a}{a + b}}}{2 \, a \cos \left (d x + c\right ) \sin \left (d x + c\right )}\right )}{2 \, b d}\right ] \]

[In]

integrate(sin(d*x+c)^2/(a+b*sin(d*x+c)^2),x, algorithm="fricas")

[Out]

[1/4*(4*d*x + sqrt(-a/(a + b))*log(((8*a^2 + 8*a*b + b^2)*cos(d*x + c)^4 - 2*(4*a^2 + 5*a*b + b^2)*cos(d*x + c
)^2 + 4*((2*a^2 + 3*a*b + b^2)*cos(d*x + c)^3 - (a^2 + 2*a*b + b^2)*cos(d*x + c))*sqrt(-a/(a + b))*sin(d*x + c
) + a^2 + 2*a*b + b^2)/(b^2*cos(d*x + c)^4 - 2*(a*b + b^2)*cos(d*x + c)^2 + a^2 + 2*a*b + b^2)))/(b*d), 1/2*(2
*d*x + sqrt(a/(a + b))*arctan(1/2*((2*a + b)*cos(d*x + c)^2 - a - b)*sqrt(a/(a + b))/(a*cos(d*x + c)*sin(d*x +
 c))))/(b*d)]

Sympy [F(-1)]

Timed out. \[ \int \frac {\sin ^2(c+d x)}{a+b \sin ^2(c+d x)} \, dx=\text {Timed out} \]

[In]

integrate(sin(d*x+c)**2/(a+b*sin(d*x+c)**2),x)

[Out]

Timed out

Maxima [A] (verification not implemented)

none

Time = 0.40 (sec) , antiderivative size = 46, normalized size of antiderivative = 1.00 \[ \int \frac {\sin ^2(c+d x)}{a+b \sin ^2(c+d x)} \, dx=-\frac {\frac {a \arctan \left (\frac {{\left (a + b\right )} \tan \left (d x + c\right )}{\sqrt {{\left (a + b\right )} a}}\right )}{\sqrt {{\left (a + b\right )} a} b} - \frac {d x + c}{b}}{d} \]

[In]

integrate(sin(d*x+c)^2/(a+b*sin(d*x+c)^2),x, algorithm="maxima")

[Out]

-(a*arctan((a + b)*tan(d*x + c)/sqrt((a + b)*a))/(sqrt((a + b)*a)*b) - (d*x + c)/b)/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 81 vs. \(2 (38) = 76\).

Time = 0.40 (sec) , antiderivative size = 81, normalized size of antiderivative = 1.76 \[ \int \frac {\sin ^2(c+d x)}{a+b \sin ^2(c+d x)} \, dx=-\frac {\frac {{\left (\pi \left \lfloor \frac {d x + c}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, a + 2 \, b\right ) + \arctan \left (\frac {a \tan \left (d x + c\right ) + b \tan \left (d x + c\right )}{\sqrt {a^{2} + a b}}\right )\right )} a}{\sqrt {a^{2} + a b} b} - \frac {d x + c}{b}}{d} \]

[In]

integrate(sin(d*x+c)^2/(a+b*sin(d*x+c)^2),x, algorithm="giac")

[Out]

-((pi*floor((d*x + c)/pi + 1/2)*sgn(2*a + 2*b) + arctan((a*tan(d*x + c) + b*tan(d*x + c))/sqrt(a^2 + a*b)))*a/
(sqrt(a^2 + a*b)*b) - (d*x + c)/b)/d

Mupad [B] (verification not implemented)

Time = 13.85 (sec) , antiderivative size = 104, normalized size of antiderivative = 2.26 \[ \int \frac {\sin ^2(c+d x)}{a+b \sin ^2(c+d x)} \, dx=\frac {\mathrm {atan}\left (\frac {2\,a\,b^2\,\mathrm {tan}\left (c+d\,x\right )}{2\,a^2\,b+2\,a\,b^2}+\frac {2\,a^2\,b\,\mathrm {tan}\left (c+d\,x\right )}{2\,a^2\,b+2\,a\,b^2}\right )}{b\,d}+\frac {\mathrm {atanh}\left (\frac {\mathrm {tan}\left (c+d\,x\right )\,\sqrt {-a\,\left (a+b\right )}}{a}\right )\,\sqrt {-a\,\left (a+b\right )}}{d\,\left (b^2+a\,b\right )} \]

[In]

int(sin(c + d*x)^2/(a + b*sin(c + d*x)^2),x)

[Out]

atan((2*a*b^2*tan(c + d*x))/(2*a*b^2 + 2*a^2*b) + (2*a^2*b*tan(c + d*x))/(2*a*b^2 + 2*a^2*b))/(b*d) + (atanh((
tan(c + d*x)*(-a*(a + b))^(1/2))/a)*(-a*(a + b))^(1/2))/(d*(a*b + b^2))